import 'package:flutter/material.dart';
import 'dart:io';
class PhotoBrowser extends StatelessWidget {

  final List<File> imageLocaleList;
  final int currentPageValue;
  PhotoBrowser({Key? key, this.currentPageValue = 0, required this.imageLocaleList})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: new AppBar(
          elevation: 0.5,
          title: new Text('图片详情'),
        ),
        backgroundColor: Colors.black,
        body: Center(
          child: PageView.builder(
              scrollDirection: Axis.horizontal,
              itemCount: imageLocaleList.length,
              controller: PageController(initialPage: currentPageValue),
              physics: ScrollPhysics(parent: BouncingScrollPhysics()),
              itemBuilder: (context, index) {
                return Image.file(
                  imageLocaleList[index],
                  fit: BoxFit.cover,
                );
              }),
        ));
  }
}
